<?php

use think\migration\Migrator;
use think\migration\db\Column;

class News extends Migrator
{
    public function up()
    {
        $users = $this->table('news', array('comment' => '新闻动态表'));
        $users->addColumn('title', 'string', array('comment' => '新闻标题'))
              ->addColumn('source', 'string', array('comment' => '新闻来源'))        
              ->addColumn('author', 'string', array('comment' => '新闻作者'))
              ->addColumn('content', 'text', array('comment' => '新闻内容'))
              ->addColumn('created_at', 'timestamp', array('default' => 'CURRENT_TIMESTAMP', 'comment' => '发布时间'))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->addColumn('deleted_at', 'timestamp', array('null' => true))
              ->save();     
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('news');
    }
}
